package models

// ViewLogRequestParam 浏览记录请求参数
type ViewLogRequestParam struct {
	ViewDuration int     `json:"viewDuration"`        // 浏览时长(秒)
	IsOrganic    *bool   `json:"isOrganic,omitempty"` // 是否自然流量(非广告)
	UtmSource    string  `json:"utmSource"`           // 广告来源(utm_source)
	UtmMedium    string  `json:"utmMedium"`           // 广告媒介(utm_medium)
	UtmCampaign  string  `json:"utmCampaign"`         // 广告活动(utm_campaign)
	UserID       *uint64 `json:"userId"`              // 用户

}

// ResourceViewLog 浏览记录模型
type ResourceViewLog struct {
	ResourceID   uint64  `gorm:"column:resource_id"`
	UserID       *uint64 `gorm:"column:user_id"`
	SessionID    string  `gorm:"column:session_id"`
	IPAddress    string  `gorm:"column:ip_address"`
	UserAgent    string  `gorm:"column:user_agent"`
	Referer      string  `gorm:"column:referer"`
	DeviceType   *int    `gorm:"column:device_type"`
	OS           string  `gorm:"column:os"`
	Browser      string  `gorm:"column:browser"`
	Country      string  `gorm:"column:country"`
	Region       string  `gorm:"column:region"`
	City         string  `gorm:"column:city"`
	ViewDuration int     `gorm:"column:view_duration"`
	IsOrganic    *bool   `gorm:"column:is_organic"`
	UtmSource    string  `gorm:"column:utm_source"`
	UtmMedium    string  `gorm:"column:utm_medium"`
	UtmCampaign  string  `gorm:"column:utm_campaign"`
}

func (ResourceViewLog) TableName() string {
	return "resource_view_log"
}
